# Maintainer: Antonio Rojas <arojas@archlinux.org>

_pipname=pplpy
pkgname=python-pplpy
pkgver=0.8.9
pkgrel=1
pkgdesc='Python wrapper to the C++ Parma Polyhedra Library (PPL)'
arch=(loong64 x86_64)
url='https://gitlab.com/videlec/pplpy/'
license=(LGPL2.1)
depends=(python-cysignals python-gmpy2 ppl)
makedepends=(cython python-build python-installer python-setuptools python-wheel python-sphinx)
source=(https://pypi.io/packages/source/${_pipname:0:1}/$_pipname/$_pipname-$pkgver.tar.gz)
sha256sums=('db7a3b571d6ef053f75137975e947c3a1c1e45a30bab90eaf215b4e5cc15797e')

build() {
  cd $_pipname-$pkgver
  python -m build --wheel --no-isolation

  _pythonver=`python -c "from sysconfig import get_python_version; print(get_python_version())"`
  PYTHONPATH="$PWD/build/lib.linux-$CARCH-cpython-${_pythonver/./}" make -C docs html
}

package() {
  cd $_pipname-$pkgver 
  python -m installer --destdir="$pkgdir" dist/*.whl

  mkdir -p "$pkgdir"/usr/share/doc/pplpy
  cp -r docs/build/html/* "$pkgdir"/usr/share/doc/pplpy
}
